from django.db import models

# Create your models here.
class User(models.Model):
    id = models.AutoField(primary_key=True)
    username = models.CharField(max_length=255)
    password = models.CharField(max_length=255)
    balance = models.DecimalField(max_digits=8, decimal_places=2, default=0)
    
    class Meta:
        db_table = 'user'
        
        
class Deal(models.Model):
    id = models.AutoField(primary_key=True)
    sell_id = models.IntegerField()
    buy_id = models.IntegerField()
    price = models.DecimalField(max_digits=8,decimal_places=2)
    num = models.IntegerField()
    type = models.CharField(max_length=5)
    
    class Meta:
        db_table = "deal"
        

class RechargeOrder(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.IntegerField()
    price = models.IntegerField()
    paymentid = models.CharField(max_length=255)
    payerid = models.CharField(max_length=255)
    token = models.CharField(max_length=255)
    state = models.IntegerField(default=0)
    
    class Meta:
        db_table = "recharge_order"
        

